package cn.lyd.base.enm;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

@Getter
@AllArgsConstructor
public enum LogininfoStateEnum {
    //后台前台人员 状态：0后台，1前台
    ACTIVITY_BEHIND(0,"后台"),
    ACTIVITY_FRONT(1,"前台");

    public static String getNameByCode(Integer code){
        Optional<LogininfoStateEnum> first = Arrays.stream(LogininfoStateEnum.values()).filter(state -> state.getCode() == code)
                .findFirst();
        return first.isPresent()?first.get().getName():"";
    }

    private int code;

    private String name;
}
